﻿
using System;
using System.Collections.Generic;
using System.Linq;
using NLite.Data;
namespace SolutionModel
{
	using NLite.Reflection;

	public partial class PurviewDBEntities:DbContext
	{
		//连接字符串名称：基于Config文件中连接字符串的配置
        const string connectionStringName = "constring";

        //构造dbConfiguration 对象
        static DbConfiguration dbConfiguration;

		static PurviewDBEntities()
		{
			 dbConfiguration = DbConfiguration
                  .Configure(connectionStringName)
                  .SetSqlLogger(() =>SqlLog.Debug)
				  .AddFromAssemblyOf<PurviewDBEntities>(t=>t.HasAttribute<TableAttribute>(false))
				  ;
		}

		//const string connectionStringName = "Data Source=.;Initial Catalog=PurviewDB;Persist Security Info=True;User ID=sa;Password=vanceinfo";
        ////构造dbConfiguration 对象
        //static DbConfiguration dbConfiguration;
		//static PurviewDBEntities()
		//{
		//	 dbConfiguration = DbConfiguration
        //          .Configure(connectionStringName, "System.Data.SqlClient")
        //          .SetSqlLogger(() =>SqlLog.Debug)
		//		  .AddFromAssemblyOf<PurviewDBEntities>(t=>t.HasAttribute<TableAttribute>(false))
		//		  ;
		//}

		public PurviewDBEntities():base(dbConfiguration){}
		
		public IDbSet<CommonClass> CommonClasses { get; private set; }
		public IDbSet<T_AdminRole> T_AdminRoles { get; private set; }
		public IDbSet<T_AdminUser> T_AdminUsers { get; private set; }
		public IDbSet<T_Advertisement> T_Advertisements { get; private set; }
		public IDbSet<T_Error> T_Errors { get; private set; }
		public IDbSet<T_Menu> T_Menus { get; private set; }
		public IDbSet<T_MenuInRole> T_MenuInRoles { get; private set; }
		public IDbSet<T_MetaLabel> T_MetaLabels { get; private set; }
		public IDbSet<T_Navbar> T_Navbars { get; private set; }
		public IDbSet<T_UsersInRole> T_UsersInRoles { get; private set; }
		public IDbSet<Test> Tests { get; private set; }
	}
}
